package org.example.security.oauth2;

import org.springframework.security.oauth2.server.authorization.token.OAuth2TokenClaimsContext;
import org.springframework.security.oauth2.server.authorization.token.OAuth2TokenClaimsSet;
import org.springframework.security.oauth2.server.authorization.token.OAuth2TokenCustomizer;

public class CustomeOAuth2TokenCustomizer implements OAuth2TokenCustomizer<OAuth2TokenClaimsContext> {

    /**
     * Customize the OAuth 2.0 Token attributes.
     * @param context the context containing the OAuth 2.0 Token attributes
     */
    @Override
    public void customize(OAuth2TokenClaimsContext context) {
        OAuth2TokenClaimsSet.Builder claims = context.getClaims();
        claims.claim("DETAILS_LICENSE", "LICENSE");
        String clientId = context.getAuthorizationGrant().getName();
        claims.claim("CLIENT_ID", clientId);
        claims.claim("ACTIVE", Boolean.TRUE);

        // 客户端模式不返回具体用户信息


    }

}
